package com.bruan.d2_collection;

import java.util.LinkedList;
public class ListTest {
    public static void main(String[] args) {
        LinkedList<String> queue = new LinkedList<>();
        System.out.println("----------模拟队列--------------");
        queue.addLast("第一号人");
        System.out.println(queue);
        queue.addLast("第二号人");
        System.out.println(queue);
        queue.addLast("第三号人");
        System.out.println(queue);
        queue.removeFirst();
        System.out.println(queue);
        queue.removeFirst();
        System.out.println(queue);
        queue.removeFirst();
        System.out.println(queue);
        System.out.println("----------模拟栈-------------");
        LinkedList<String> list = new LinkedList<>();
        list.addFirst("第1颗子弹"); // 相当于list.push()
        System.out.println(list);
        list.addFirst("第2颗子弹");
        System.out.println(list);
        list.removeFirst(); // 相当于list.pop()
        System.out.println(list);
        list.removeFirst();
        System.out.println(list);




    }
}
